<!--
 * @Description: 
 * @version: 
 * @Author: liurui
 * @Date: 2024-02-18 14:22:01
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-02-18 15:10:02
-->
<template>
    <div>

    </div>
</template>

<script setup lang="ts">
// 类型接收一个数组，如果数组中任一个元素为真，则返回 true，否则返回 false。如果数组为空，返回 false

type Sample1 = AnyOf<[1, '', false, [], {}]>; // expected to be true.
type Sample2 = AnyOf<[0, '', false, [], {}]>; // expected to be false.

export type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;

type Zerolist = 0 | false | '' | [] | undefined | null;

type AnyOf<T extends readonly any[]> = T extends [infer F, ...infer R]
  ? F extends Zerolist
    ? AnyOf<R>
    : // 单独处理 {} 的判定
    Equal<F, {}> extends true
    ? AnyOf<R>
    : true
  : false;
</script>

<style scoped>

</style>